<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <cpn v-show="isShow"></cpn>  <!-- 这里使用vue实例的isShow而不是模板的isShow -->
    </div>

    <template id="cpn">
        <div>
            <h2>我是子组件</h2>
            <p>我是内容，哈哈哈</p>
            <button v-show="isShow">按钮</button> <!-- 这里使用模板的isShow而不是vue实例的isShow -->
        </div>
    </template>

    <script src="../js/vue.js"></script>
    <script>
        const app = new Vue({
            el: '#app',
            data: {
                message: "你好呀",
                isShow: true,
            },
            components: {
                cpn: {
                    template: '#cpn',
                    data() {
                        return {
                            isShow: false,
                        }
                    }
                }
            }
        })
    </script>
</body>

</html>